package model.symbol;

import model.code.CodeFileChunk;
import model.code.line.LineList;
import model.code.line.MultiLineList;
import model.code.line.NameLine;

/**
 * This class is for all keywords built-in to a language.
 *
 * @author Neil Dickson
 */
public class Keyword implements Symbol {
	private final long		id;
	private final String	keyword;
	private final String	description;
	private final NameLine	name;
	private final MultiLineList	descriptionLine;
	private final boolean	isLineStart;

	public Keyword(String keyword,String description) {
		this(false,keyword,description);
	}
	public Keyword(boolean isLineStart,String keyword,String description) {
		id = Scope.getUniqueID();
		this.keyword = keyword;
		this.description = description;
		this.isLineStart = isLineStart;
		name = new NameLine(keyword.toCharArray(),null,CodeFileChunk.LOCATION_NAME,0,this);
		descriptionLine = new MultiLineList(null,CodeFileChunk.LOCATION_DESCRIPTION,0);
		descriptionLine.replaceAll(description);
	}

	public NameLine getName() {
		return name;
	}

	public LineList getDescription() {
		return descriptionLine;
	}

	public long getID() {
		return id;
	}

	public String toString() {
		return keyword;
	}

	public boolean isLineStart() {
		return isLineStart;
	}
}
